package com.sgb.kjwl.view.ui.activity.enterprise;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.tabs.TabLayout;
import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ActivityNewneeddetailBinding;
import com.sgb.kjwl.model.entity.NeedDetailsEntity;
import com.sgb.kjwl.utils.ActivityJump;
import com.sgb.kjwl.utils.DialogFunction;
import com.sgb.kjwl.utils.PointUtils;
import com.swgk.core.util.UserOperating;
import com.sgb.kjwl.view.ui.activity.manage.WebsiteInfoActivity;
import com.sgb.kjwl.view.ui.activity.self.authentication.CertificationActivity;
import com.sgb.kjwl.view.ui.activity.self.userInfo.VerificationCodeLoginActivity;
import com.sgb.kjwl.view.ui.adapter.enterprise.NewNeedDataAdpater;
import com.sgb.kjwl.viewmodel.enterprise.NeedDetailsViewModel_New;
import com.swgk.core.base.aroute.AppRouteConstant;
import com.swgk.core.dialog.DialogHelper;
import com.swgk.core.util.ClickUtils;
import com.swgk.core.util.MToast;
import com.swgk.core.util.SharedPreferenceUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * 需求大厅详情
 */
@Route(path = AppRouteConstant.QiYeFuWu.ROUTER_PATH_NEWNEEDDETAILSACTIVITY)
public class NewNeedDetailsActivity extends AppActivity {

    private NeedDetailsViewModel_New mViewModel;
    private ActivityNewneeddetailBinding mBinding;
    private NewNeedDataAdpater madpater;
    private boolean stopTabLayoutScroll = false;
    private boolean stopRecyclerViewScroll = false;
    private LinearLayoutManager mLinearLayoutManager;
    private int mIndex = 0;
    RequestOptions options;
    RequestOptions personOptions;
    RequestOptions teamOptions;
    private boolean isTeam = false;//当前是团队
    private String businessId = "";
    private String businessName = "";
    private String dealCompanyName = "";
    private String dealCompanyNo = "";
    private String dealTeamName = "";
    private String dealTeamNo = "";
    private String dealUserName = "";
    private String dealUserNo = "";
    private String dataId = "";
    private String category = "";
    private String mNeedId;
    private int statusGZ = 0;//0未关注
    private String linkmanPhone = "";
    private String userAccount = "";
    private String linkMan = "";
    private String mTag;
    private String mId;
    private String userno;
    private int publishtype = -1;
    private NeedDetailsEntity mNeedDetailsEntity;

    public static void startactivity(Context mContext, String id) {
        Intent mIntent = new Intent();
        mIntent.setClass(mContext, NewNeedDetailsActivity.class);
        mIntent.putExtra("data", id);
        mContext.startActivity(mIntent);


    }


    @Override
    protected void initView() {
        super.initView();
        mViewModel = new ViewModelProvider(this).get(NeedDetailsViewModel_New.class);
        mViewModel.setMitemid(getIntent().getStringExtra("data"));

        mBinding = DataBindingUtil.setContentView(this, R.layout.activity_newneeddetail);
        mBinding.setVariable(BR.needmodel, mViewModel);
        mBinding.setLifecycleOwner(this);


        options = new RequestOptions().placeholder(R.mipmap.gongsiqiye)//图片加载出来前，显示的图片
                .fallback(R.mipmap.gongsiqiye) //url为空的时候,显示的图片
                .error(R.mipmap.gongsiqiye);//图片加载失败后，显示的图片

        personOptions = new RequestOptions().placeholder(R.mipmap.morentu_person)//图片加载出来前，显示的图片
                .fallback(R.mipmap.morentu_person) //url为空的时候,显示的图片
                .error(R.mipmap.morentu_person);//图片加载失败后，显示的图片

        teamOptions = new RequestOptions().placeholder(R.mipmap.morentu_tuandui)//图片加载出来前，显示的图片
                .fallback(R.mipmap.morentu_tuandui) //url为空的时候,显示的图片
                .error(R.mipmap.morentu_tuandui);//图片加载失败后，显示的图片


        initRecyclerView();
        initTabLayout();
        initobsever();

    }

    private void initRecyclerView() {

        mLinearLayoutManager = new LinearLayoutManager(this);
        mBinding.recyclerView.setLayoutManager(mLinearLayoutManager);

    }


    private void initTabLayout() {


        for (String s : mViewModel.titleList) {
            mBinding.tabLayout.addTab(mBinding.tabLayout.newTab().setText(s));
        }

        mBinding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                mIndex = tab.getPosition();
                if (mIndex != 0) {
                    scrollToTop();
                }

                int firstItem = mLinearLayoutManager.findFirstVisibleItemPosition();
                int lastItem = mLinearLayoutManager.findLastVisibleItemPosition();
                //然后区分情况

                if (mIndex <= firstItem) {
                    //当要置顶的项在当前显示的第一个项的前面时
                    mBinding.recyclerView.scrollToPosition(mIndex);
                } else if (mIndex <= lastItem) {
                    //当要置顶的项已经在屏幕上显示时
                    int top = mBinding.recyclerView.getChildAt(mIndex - firstItem).getTop();
                    mBinding.recyclerView.scrollBy(0, top);
                } else {
                    //当要置顶的项在当前显示的最后一项的后面时
                    mBinding.recyclerView.scrollToPosition(mIndex);
                    //这里这个变量是用在RecyclerView滚动监听里面的
                }

                stopRecyclerViewScroll = true;
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });

    }


    private void initobsever() {

        mViewModel.ShowLoading.observe(this, type -> {
            switch (type) {
                case 1:
                    DialogHelper.showProgressDialog(NewNeedDetailsActivity.this, null, "数据加载中...", 0, false, null).setCanceledOnTouchOutside(false);
                    break;
                case 2:
                    DialogHelper.dismissProgressDialog();
                    break;
            }
        });
        mViewModel.Toast_until.observe(this, message -> {
            MToast.showLongToast(this, message);

        });

        mViewModel.list_recomend.observe(this, list_recomend -> {
            madpater.setList_data(list_recomend);
        });

        mViewModel.date_detail.observe(this, data -> {
            mBinding.recyclerView.removeAllViews();
            mNeedDetailsEntity = data;
            madpater = new NewNeedDataAdpater(this);
            madpater.setIshome(true);
            publishtype = data.publishType;
            madpater.setNeedDetail(data);//填充详情数据
            mBinding.recyclerView.setAdapter(madpater);
            mBinding.coordinator.setVisibility(View.VISIBLE);
            mViewModel.getsignuplist(data.id + "");
            mViewModel.follow_company.postValue(data.isFocusStatus());
            if ("0".equals(data.getWhetherPublic())) {
                if (System.currentTimeMillis() < data.getPublicityPeriod()) {
                    mBinding.linEnd.setVisibility(View.VISIBLE);
                } else {
                    mBinding.linEnd.setVisibility(View.GONE);
                }

            }
            if (!"1".equals(data.demandStatus)) {//已下架
                mBinding.tabLayout.setVisibility(View.GONE);
                mBinding.bidLayout.setVisibility(View.GONE);
                mBinding.llTilte.setVisibility(View.GONE);
                return;
            } else {
                mBinding.llTilte.setVisibility(View.VISIBLE);
                mBinding.bidLayout.setVisibility(View.VISIBLE);
            }
            if (data.getBudgetPrice() > -1) {
                mBinding.tvPrice.setText("￥" + PointUtils.price(data.getBudgetPrice()));
            } else {
                mBinding.tvPrice.setText("议价");
            }
            userno = data.userNo + "";
            setImage(data.publishType, mBinding.ivArrow, data.companyNo, data.getTeamNo(), data.userImg, data.companyLogo, data.getLogo(), mBinding.civPublishType, mBinding.ivPublishType, data.userRealName, data.getCompanyName()
                    , data.realName, mBinding.tvRealName
                    , "个人认证", data.userIsAuth, data.companyServiceType, data.companyIsAuth, data.getBusinessType(), data.getTeamAuth(), mBinding.tvCompanyIsAuth);

            businessId = String.valueOf(data.id);
            businessName = data.demandTitle;
            if (data.publishType == 1) {
                dealCompanyName = data.getCompanyName();
                dealCompanyNo = data.companyNo;
            } else if (data.publishType == 2) {
                dealTeamName = data.realName;
                dealTeamNo = data.getTeamNo();
            } else {
                dealUserName = data.userRealName;
                dealUserNo = data.userNo;
            }

            switch (data.getOfferStatus()) {
                case 1:
                    mBinding.tvTypeBj.setBackgroundResource(R.drawable.shape_tag_color_1a5792fd_radius_2);
                    break;
                case 2:
                    mBinding.tvTypeBj.setBackgroundResource(R.drawable.shape_tage_color_666666_radius_2);
                    mBinding.tvTypeBj.setTextColor(Color.parseColor("#666666"));
                    break;
                case 3:
                    mBinding.tvTypeBj.setBackgroundResource(R.drawable.shape_tage_color_666666_radius_2);
                    mBinding.tvTypeBj.setTextColor(Color.parseColor("#666666"));
                    break;
            }

            isTeam = data.publishType == 2;
            linkMan = data.linkMan;
            linkmanPhone = data.getLinkmanPhone();
            userAccount = data.userAccount;


            mBinding.llReport.setOnClickListener(view -> {
                if (!ClickUtils.isDoubleClick()) {
                    if (!UserOperating.getInstance().isLogged()) {
                        VerificationCodeLoginActivity.start(this);
                    } else {
                        if (UserOperating.getInstance().isTeam() || isTeam) {
                            com.sgb.kjwl.utils.DialogHelper.showSingleDialog(this, "温馨提示", "该功能正在开发中，敬请期待！", "确定", true, new DialogFunction() {
                                @Override
                                public void normalRoundDialog() {

                                }
                            });
                        } else {
                            ReportEnterpriseActivity.start(this, businessId, businessName, "2", "7", dealCompanyName, dealCompanyNo,
                                    dealTeamName, dealTeamNo, dealUserName, dealUserNo);
                        }
                    }
                }
            });

            mBinding.llFocus.setOnClickListener(view -> {
                if (!ClickUtils.isDoubleClick()) {
                    if (!UserOperating.getInstance().isLogged()) {
                        VerificationCodeLoginActivity.start(this);
                    } else {

                        if (ismeno(publishtype, mViewModel.date_detail.getValue().getCompanyNo(), mViewModel.date_detail.getValue().getTeamNo(), mViewModel.date_detail.getValue().getUserNo())) {
                            MToast.showToast(this, "不能关注当前账号下发布的内容！");
                            return;
                        }
                        Map<String, Object> map = new HashMap<>();
                        map.put("id", mViewModel.mitemid);
                        map.put("dataId", dataId);
                        map.put("type", 2);
                        map.put("attentionNot", statusGZ);
                        map.put("attentionTime", System.currentTimeMillis());
                        map.put("attentionNo", SharedPreferenceUtil.getInstance().getString(SharedPreferenceUtil.USER_NO, ""));
                        mViewModel.focusNeed(map, statusGZ);
                    }
                }
            });

            mBinding.llHanxun.setOnClickListener(view -> {
                if (!ClickUtils.isDoubleClick()) {
                    if (!UserOperating.getInstance().isLogged()) {
                        VerificationCodeLoginActivity.start(this);
                    } else {
                        if (UserOperating.getInstance().isTeam() || isTeam) {
                            com.sgb.kjwl.utils.DialogHelper.showSingleDialog(this, "温馨提示", "该功能正在开发中，敬请期待！", "确定", true, new DialogFunction() {
                                @Override
                                public void normalRoundDialog() {

                                }
                            });
                        } else {
                            EnterpriseInquireByLetterActivity.start(this, "2", "7",
                                    businessId, businessName, dealCompanyName, dealCompanyNo, dealUserName, dealUserNo);
                        }
                    }
                }
            });


            mBinding.llCall.setOnClickListener(view -> {
                if (!ClickUtils.isDoubleClick()) {
                    if (com.sgb.kjwl.utils.DialogHelper.checkLogin()) {
                        com.sgb.kjwl.utils.DialogHelper.showDialog(this, "确认呼叫", linkmanPhone, "确定", new DialogFunction() {
                            @Override
                            public void normalRoundDialog() {
                                ActivityJump.jumpToPhone(NewNeedDetailsActivity.this, linkmanPhone);
                            }
                        });
                    } else {
                        if ("".equals(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, ""))) {
                            VerificationCodeLoginActivity.start(NewNeedDetailsActivity.this);
                            return;
                        }
                    }
                }
            });

            mBinding.tvLinkphone.setOnClickListener(view -> {
                if (!ClickUtils.isDoubleClick()) {
                    if (com.sgb.kjwl.utils.DialogHelper.checkLogin()) {
                        com.sgb.kjwl.utils.DialogHelper.showDialog(this, "确认呼叫", linkmanPhone, "确定", new DialogFunction() {
                            @Override
                            public void normalRoundDialog() {
                                ActivityJump.jumpToPhone(NewNeedDetailsActivity.this, linkmanPhone);
                            }
                        });
                    } else {
                        if ("".equals(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, ""))) {
                            VerificationCodeLoginActivity.start(NewNeedDetailsActivity.this);
                            return;
                        }
                    }
                }
            });

            mBinding.bottomView.setOnClickListener(view -> {
                if (!ClickUtils.isDoubleClick()) {
                    if ("".equals(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, ""))) {
                        VerificationCodeLoginActivity.start(NewNeedDetailsActivity.this);
                        return;
                    }
                    if (!SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
                        com.sgb.kjwl.utils.DialogHelper.showDialog(getActivity(), "温馨提示", "请先完成实名认证", "去认证", new DialogFunction() {
                            @Override
                            public void normalRoundDialog() {
                                CertificationActivity.start(getActivity(), "1");
                            }
                        });
                        return;
                    }
                    if (ismeno(publishtype, mViewModel.date_detail.getValue().getCompanyNo(), mViewModel.date_detail.getValue().getTeamNo(), mViewModel.date_detail.getValue().getUserNo())) {
                        MToast.showToast(this, "不支持对当前账号发布的需求报价！");
                        return;
                    }

                    mViewModel.goQuotation();
                }
//                MToast.showToast(this, "该功能正在开发中，敬请期待！");
            });


            mBinding.llBtn.setOnClickListener(v -> {

                if (!ClickUtils.isDoubleClick()) {
                    if (!mTag.equals("没有店铺")) {
                        if (mId.equals("企业")) {
//                        ActivityJump.jumpToActivity(this, ShopInfoForCompanyTradesActivity.class, Pair.create("id", mTag + ""));
                            WebsiteInfoActivity.start(this, mTag, WebsiteInfoActivity.WEBSITE_FOR_COMPANY);
                        } else {
                            WebsiteInfoActivity.start(this, mTag, WebsiteInfoActivity.WEBSITE_FOR_TEAM);
                        }
                    } else {
                        WebsiteInfoActivity.start(this, userno, WebsiteInfoActivity.WEBSITE_FOR_PERSONAL);
                    }
                }

            });


            if (data.publishType == 1) {
                mViewModel.companyId = data.companyNo;
//                mViewModel.getUserFocusCompanyStatus();

                mBinding.tvFollow.setOnClickListener(new View.OnClickListener() {//企业关注
                    @Override
                    public void onClick(View view) {
                        if (!ClickUtils.isDoubleClick()) {
                            if ("".equals(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, ""))) {
                                VerificationCodeLoginActivity.start(NewNeedDetailsActivity.this);
                                return;
                            }


                            if (!SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
                                com.sgb.kjwl.utils.DialogHelper.showDialog(getActivity(), "温馨提示", "请先完成实名认证", "去认证", new DialogFunction() {
                                    @Override
                                    public void normalRoundDialog() {
                                        CertificationActivity.start(getActivity(), "1");
                                    }
                                });
                                return;
                            }

                            mViewModel.attentionCompanyStatus();
                        }
                    }
                });
            }
        });

        mViewModel.isgz.observe(this, gz -> {
            setTvIsGz(gz);
        });
        mViewModel.dataid.observe(this, string_id -> {
            dataId = string_id;
        });

        mViewModel.follow_company.observe(this, follow_type -> {
            setAttentionCompanyStatus(follow_type);
        });


        mViewModel.list_signup.observe(this, data -> {
            if (madpater != null) {
                madpater.setNeedDetailSignUpData(data);
            }
        });

        mViewModel.goQuote.observe(this, a -> {
            if (mNeedDetailsEntity != null) {
                AddNeedQuoteActivity.start(this, mNeedDetailsEntity.realName, mNeedDetailsEntity.demandTitle, mNeedDetailsEntity.id, mNeedDetailsEntity.requirementTypes);
            }
        });
    }


    private void initData() {
        if (mViewModel != null) {//刷新企业关注状态
            mViewModel.getDetails();
            mViewModel.getAttentionStatus(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.USER_NO, ""), 2, getIntent().getStringExtra("id"));
//            mViewModel.getUserFocusCompanyStatus();
        }

    }

    public void setTvIsGz(int isGz) {
        //标是否关注
        if (isGz == 1) {
            statusGZ = 0;
        } else {
            statusGZ = 1;
        }
        updateUserFocusBg();
    }

    private void updateUserFocusBg() {
        //标是否关注
        if (statusGZ == 0) {
            Drawable drawable = getResources().getDrawable(R.mipmap.icon_follow_gray);
            mBinding.ivFocus.setImageDrawable(drawable);
            mBinding.tvUserFocus.setText("关注");
        } else {
            Drawable drawable = getResources().getDrawable(R.mipmap.icon_follow_red);
            mBinding.ivFocus.setImageDrawable(drawable);
            mBinding.tvUserFocus.setText("已关注");
        }
    }

    /*
     * 设置关注企业网站状态
     * */
    public void setAttentionCompanyStatus(Boolean flag) {

        mBinding.tvFollow.setText(flag ? "已关注" : "关注");
        mBinding.tvFollow.setBackgroundResource(flag ? R.drawable.shape_colorc0c4cc_corneras10 : R.drawable.shape_red_btn_line_corneras10);
        mBinding.tvFollow.setTextColor(flag ? Color.parseColor("#969696") : Color.parseColor("#EF4033"));
        mBinding.tvFollow.setTextColor(flag ? Color.parseColor("#969696") : Color.parseColor("#ef4033"));
    }


    @SuppressLint("SetTextI18n")
    public void setImage(int publishType, ImageView imageArrow, String companyId, String teamId
            , String urlPerson, String urlCompany, String urlTeam, ImageView imageViewPerson, ImageView imageViewCompany
            , String namePerson, String nameCompany, String nameTeam, TextView nameTextView
            , String authStatusPerson, int personAuth, String authStatusCompany, int companyAuth, String authStatusTeam, int teamAuth, TextView authStatusTextView) {
        String url, name, authStatus;
        RequestOptions optionsP;
        ImageView imageView;
        if (publishType == 0) {
            optionsP = personOptions;
            url = urlPerson;
            imageArrow.setVisibility(View.VISIBLE);
            name = namePerson;

            authStatus = "";
            if (personAuth == 1) {
                authStatusTextView.setVisibility(View.VISIBLE);
            } else {
                authStatusTextView.setVisibility(View.GONE);
            }
            imageView = imageViewPerson;
            imageViewCompany.setVisibility(View.GONE);
            imageViewPerson.setVisibility(View.VISIBLE);
            mBinding.tvFollow.setVisibility(View.GONE);
            mTag = "没有店铺";
        } else if (publishType == 1) {
            optionsP = options;
            url = urlCompany;
            imageArrow.setVisibility(View.VISIBLE);

            name = nameCompany;

            authStatus = authStatusCompany;
            if (companyAuth == 1) {
                authStatusTextView.setVisibility(View.VISIBLE);
            } else {
                authStatusTextView.setVisibility(View.GONE);
            }
            imageView = imageViewCompany;
            imageViewCompany.setVisibility(View.VISIBLE);
            imageViewPerson.setVisibility(View.GONE);

            if (name != null && !name.equals("")) {
                imageArrow.setVisibility(View.VISIBLE);
            } else {
                imageArrow.setVisibility(View.GONE);
            }
            mBinding.tvFollow.setVisibility(View.VISIBLE);
            mTag = companyId;
            mId = "企业";
        } else {
            optionsP = teamOptions;
            url = urlTeam;
            imageArrow.setVisibility(View.VISIBLE);

            name = nameTeam;

            authStatus = authStatusTeam;
            if (teamAuth == 2) {
                authStatusTextView.setVisibility(View.VISIBLE);
            } else {
                authStatusTextView.setVisibility(View.GONE);
            }
            imageView = imageViewPerson;
            imageViewCompany.setVisibility(View.GONE);
            imageViewPerson.setVisibility(View.VISIBLE);

            if (name != null && !name.equals("")) {
                imageArrow.setVisibility(View.VISIBLE);
            } else {
                imageArrow.setVisibility(View.GONE);
            }
            mTag = teamId;
            mId = "团队";
            Glide.with(this).load(url).apply(optionsP).into(imageView);
            mBinding.tvFollow.setVisibility(View.GONE);
        }

        try {
            if (publishType != 2) {
                Glide.with(this).load(url).apply(optionsP).into(imageView);
            }
        } catch (Exception e) {
        }
        nameTextView.setText(name);

        if (!TextUtils.isEmpty(authStatus)) {
            authStatusTextView.setVisibility(View.VISIBLE);
            authStatusTextView.setText(authStatus);
        } else {
            authStatusTextView.setVisibility(View.GONE);
        }

    }


    public void scrollToTop() {
        //拿到 appbar 的 behavior,让 appbar 滚动
        ViewGroup.LayoutParams layoutParams = mBinding.appBarLayout.getLayoutParams();
        CoordinatorLayout.Behavior behavior =
                ((CoordinatorLayout.LayoutParams) layoutParams).getBehavior();
        if (behavior instanceof AppBarLayout.Behavior) {
            AppBarLayout.Behavior appBarLayoutBehavior = (AppBarLayout.Behavior) behavior;
            //拿到下方tabs的y坐标，即为我要的偏移量
            float y = mBinding.tabLayout.getY();
            //注意传递负值
            appBarLayoutBehavior.setTopAndBottomOffset((int) -y);
        }

    }


    /**
     * 判定是否是自己角色
     */
    public boolean ismeno(int publishtype, String companyno, String teamno, String userno) {
        int metype = UserOperating.getInstance().isCompany() ? 1 : UserOperating.getInstance().isTeam() ? 2 : 0;
        switch (publishtype) {
            case 1://公司
                if (metype == 1 && SharedPreferenceUtil.getInstance().getString(SharedPreferenceUtil.COMPANY_NO, "").equals(companyno)) {
                    return true;
                }
                break;
            case 2://团队
                if (metype == 2 && SharedPreferenceUtil.getInstance().getString(SharedPreferenceUtil.COMPANY_NO, "").equals(teamno)) {
                    return true;
                }
                break;
            default:
                if (metype == 0 && SharedPreferenceUtil.getInstance().getString(SharedPreferenceUtil.USER_NO, "").equals(userno)) {
                    return true;
                }
                break;
        }

        return false;
    }

    @Override
    protected void onResume() {
        super.onResume();
        initData();

    }
}
